package inph.account.common;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JpaUtil {
	private static EntityManagerFactory managerFactory = null; 
	static{
		getManagerFactory();
	}
	
	public static EntityManager getEntityManager(){
		return getManagerFactory().createEntityManager();
	}
	
	public static EntityManagerFactory getManagerFactory(){
		if(managerFactory==null){
			managerFactory = Persistence.createEntityManagerFactory("inph");
		}
		return managerFactory;
	}
}
